package com.panshi.service.impl;

import com.panshi.mapper.QuestionMapper;
import com.panshi.service.QuestionService;
import com.panshi.vo.PageSizeVO;
import com.panshi.vo.QuestionVO;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.List;
@Service
public class QuestionServiceImpl implements QuestionService {

    @Resource
    private QuestionMapper questionMapper;

    @Override
   // @CacheEvict(value="personalque",allEntries=true)
    public void deleteQue(int qid) {
        questionMapper.deleteQue(qid);
    }

    @Override
  //  @Cacheable(value = "personalque",key = "#root.methodName+#pageSizeVO.startIndex")
    public List<QuestionVO> findQueQuery(@RequestBody PageSizeVO pageSizeVO) {
        pageSizeVO.setStartIndex(pageSizeVO.getStartIndexInfo());
        return questionMapper.findQueQuery(pageSizeVO);
    }

    @Override
   // @Cacheable(value = "personalque",key = "#root.methodName+#pageSizeVO.startIndex")
    public List<QuestionVO> findQuerQuery(PageSizeVO pageSizeVO) {
        return questionMapper.findQuerQuery(pageSizeVO);
    }

    @Override
    public void updatequeNo(int qid_no) {
        questionMapper.updatequeNo(qid_no);
    }

    @Override
    public Integer queryquestioncount(int uid) {
        return questionMapper.queryquestioncount(uid);
    }

    @Override
    public Integer queryquestionnocount(int uid) {
        return questionMapper.queryquestionnocount(uid);
    }


}
